<script setup lang="ts">
import {defineProps, PropType} from 'vue'
defineProps({
  site: {
    type: Object as PropType<FriendLinkVO>,
    default: () => {
      return {
        id: 1,
        siteName: '',
        siteUrl: '',
        remark: '',
        logoUrl: '',
        extraVoList: []
      } as FriendLinkVO
    }
  }
})
</script>

<template>
  <div class="link-card">
    <div class="site-container">
      <div class="site-logo">
        <img v-lazy="site.logoUrl" alt="" />
      </div>
      <div class="site-info">
        <a class="site-name" :href="site.siteUrl">{{ site.siteName }}</a>
        <div class="site-description">
          {{ site.remark }}
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped lang="less">
.link-card {
  width: 305px;
  height: 86px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  padding: 16px;
  box-sizing: border-box;
}
.site-container {
  display: flex;
  align-items: center; // 垂直居中
  gap: 12px;
  .site-logo {
    min-width: 54px;
    width: 54px;
    height: 54px;
    border: 1px solid #e0e0e0;
    //box-sizing: border-box;
    border-radius: 50%;
    overflow: hidden;
    & > img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
  .site-info {
    flex: 1;
    overflow: hidden;         /* 超出容器部分隐藏 */
    .site-name {
      color: #333333;
      font-weight: 500;
      font-size: 20px;
      line-height: 29px;
      text-decoration: none; // 去掉链接下划线
      &:hover {
        color: #EB5C88;
      }
    }
    .site-description {
      margin-top: 4px;
      color: #666666;
      font-weight: 400;
      font-size: 14px;
      line-height: 20px;
    }
  }
}
.site-name, .site-description {
  white-space: nowrap;      /* 确保文本不换行 */
  overflow: hidden;         /* 超出容器部分隐藏 */
  text-overflow: ellipsis;  /* 超出部分显示省略号 */
}
</style>
